#ifndef IMESSAGE_H
#define IMESSAGE_H

#include "Messages.h"
#include "System.h"

class World;
class Renderer;

struct MouseMessage
{
    bool valid;
    bool lmbClick;
    bool lmbRelease;
    bool rmbClick;
    bool rmbRelease;
    int mpos_x;
    int mpos_y;
};

class MessageProcessor
{
public:
    static MessageProcessor &GetInstance();

private:
    MessageProcessor();
    ~MessageProcessor();

public:
    void SetWorld(World *world);
    void SetRenderer(Renderer *renderer);
    void ClearSystemMessages();
    void SetSystemMessages(SystemMessages *sysMess);
//    void AddSystemMessage(SystemMessage sysMess);

    WorldMessages& GetWorldMessages();
    CameraMessages& GetCameraMessages();

    MouseMessage GetMouseMessage();

    bool IsLeftMouseButtonPressed();
    vector2i GetMosePosition();

    void SetSystem(System *sys);

private:
//    WorldMessages& getWorldMessages(SystemMessage sysMess);
    CameraMessages& getCameraMessages(SystemMessage sysMess);
    ECameraMessage formMessage(int x, int y);

    bool haveMessage(ESystemMessage mess);
private:
    SystemMessages  *m_SystemMessages;
    WorldMessages   m_WorldMessages;
    CameraMessages  m_CameraMessages;

    MouseMessage m_MouseMessage;

    System *m_System;

    World *m_World;
    Renderer *m_Renderer;
};


#endif // IMESSAGE_H
